<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;

$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';

$return['diy']=$this->plugin_setting('diy');
$basic=$this->plugin_setting('basic');
$return['banner']=$basic['image'];
$return['basic']=$basic;
if($_RQ['op']=='main'){
	//是否关注
	$groupid=intval($_RQ['groupid']);
	$return['rtitle']=pdo_getcolumn('jy_xiuvote_groups',array('uniacid'=>$_SESSION['uniacid'],'id'=>$groupid),'title');
	if(!$return['rtitle']){
		exi('没有找到该分类','error');
	}
	$return['isfollow']=pdo_getcolumn('core_fans',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']),'follow');
	$params=array('uniacid'=>$_SESSION['uniacid'],'groupid'=>$groupid);
	if($_RQ['keyword']){
		if(is_numeric($_RQ['keyword'])){
			$params['id']=intval($_RQ['keyword']);
			$return['params']['id']=intval($_RQ['keyword']);
		}else{
			$params['title like']='%'.$_RQ['keyword'].'%';
			$return['params']['title']=$_RQ['keyword'];
		}
	}
	//按点赞数排序作品
	$list=pdo_getall('jy_xiuvote_reply',$params,'','id desc');
	if($list){
		foreach($list as &$r){
			$r['onum']=pdo_count('jy_xiuvote_opus',array('uniacid'=>$_SESSION['uniacid'],'rid'=>$r['id']));
			if($r['starttime']<time() && $r['endtime']>time()){
				$r['status']=1;
			}elseif($r['endtime']<time()){
				$r['status']=2;
			}else{
				$r['status']=3;
			}
		}
	}
	$return['list']=$list;
	$return['onum']=count($list);
	
	set_html('title',$return['rtitle']);
	$return['sharedata']=array(
		'title'=>'活动列表'.$basic['share_title'],
		'desc'=>'活动列表'.$basic['share_desc'],
		'link'=>custom_url('jy_xiuvote/r_list/',true),
		'imgUrl'=>ATTACHMENT_URL.$basic['share_image'],
	);
	exi($return);
}	
